package main

import (
	"flag"
	"gateway/internal/svc"

	"gateway/internal/config"
	"gateway/internal/handler"

	"github.com/zeromicro/go-zero/core/conf"
	"github.com/zeromicro/go-zero/rest"
)

var configFile = flag.String("f", "etc/gateway-api.yaml", "配置文件")

func main() {
	flag.Parse()

	var c config.Config
	conf.MustLoad(*configFile, &c)

	server := rest.MustNewServer(c.RestConf)
	defer server.Stop()

	svc.NewServiceContext(c)

	// 模块化注册
	userModule := &handler.UserGateway{}
	userModule.RegisterRoutes(server)

	server.Start()
}
